<?php

namespace app\common\validate;

use think\Validate;

class Admin extends Validate
{
	protected $rule = [
		"account" => "require|unique:admin",
		"oldpassword" => "require",
		"password" => "require",
		"repassword" => "require|confirm:password",
		"role_id" => "require",
	];
	protected $message = [
		"account.require" => "请输入账号",
		"account.unique" => "账号已经存在",
		"oldpassword.require" => "请输入原密码",
		"password.require" => "请输入密码",
		"repassword.require" => "请重复输入密码",
		"repassword.confirm" => "两次输入的密码不一致",
		"role_id.require" => "请选择权限组",
	];

	protected $scene = [
		'add'  =>  ['account', 'password', 'repassword', 'role_id'],
		'update'  =>  ['account', 'role_id'],
		'update_password'  =>  ['password', 'repassword'],
		'login'  =>  ['password'],
		'password'  =>  ['oldpassword', 'password', 'repassword'],
	];
}
